package com.sysu.dinner.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.sysu.dinner.dao.ManagerDAO;
import com.sysu.dinner.model.Manager;

@Component("managerService")
public class ManagerService {
	private ManagerDAO managerDao;
	
	public boolean isExist(String name,String phone){
		if(name!=null && phone != null)
			return managerDao.isExist(name, phone);
		return false;
	}
	
	public Manager getManager(String name,String phone)
	{
		return managerDao.getManagerByNameAndPhone(name, phone);
	}

	public int addManager(Manager manager){
		if(manager != null)
			return managerDao.addManager(manager);
		return 0;
	}
	
	public boolean isVaild(String name,String password,String phone) {
		if(name!=null && password!=null && phone!=null)
			return managerDao.isValid(name, password, phone);
		return false;
	}
	
	@Resource
	public void setManagerDao(ManagerDAO managerDao) {
		this.managerDao = managerDao;
	}

	public ManagerDAO getManagerDao() {
		return managerDao;
	}
	
	

}
